package com.yanyilu.qiubite.controller;

import com.yanyilu.qiubite.jwt.JwtIgnore;
import com.yanyilu.qiubite.service.CodeService;
import com.yanyilu.qiubite.util.R;
import com.yanyilu.qiubite.util.ResultCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("code")
@CrossOrigin
public class CodeController {
    @Autowired
    CodeService codeService;
    ///qiubite/code/sendcode
    @JwtIgnore
    @RequestMapping("sendcode")
    public R sendCode(@RequestParam("phoneNumber")String phoneNumber){
        if(codeService.sendCode(phoneNumber)){
            return R.ok();
        }else{
            return R.error("验证码发送失败");
        }
    }
}
